package com.orange.notificationsummary.event;

public class MessageInfo implements Comparable<MessageInfo> {

	public static final int	STATE_READ		= 1;
	public static final int	STATE_UNREAD	= 0;

	private int				mMsgId;
	private int				mMsgType;
	private long			mThreadId;
	private int				mReadStatus;
	private String			mAddress;
	private long			mDate;
	private String			mMmsSubject;
	private String			mMmsContent;
	private String			mSmsContent;
	private String			mRecipientId;
	private String			mSnippet;

	public MessageInfo(int msgId, int msgType, long threadId, int readStatus,
			String address, long date, String smsContent, String mmsSubject,
			String mmsContent) {
		super();
		mMsgId = msgId;
		mMsgType = msgType;
		mThreadId = threadId;
		mReadStatus = readStatus;
		mAddress = address;
		mDate = date;
		mSmsContent = smsContent;
		mMmsSubject = mmsSubject;
		mMmsContent = mmsContent;
	}

	public MessageInfo(String recipientId, String snippet) {
		super();
		mRecipientId = recipientId;
		mSnippet = snippet;
	}

	public String getRecipientId() {
		return mRecipientId;
	}

	public String getSnippet() {
		return mSnippet;
	}

	public int getMsgId() {
		return mMsgId;
	}

	public void setMsgId(int msgId) {
		mMsgId = msgId;
	}

	public int getMsgType() {
		return mMsgType;
	}

	public void setMsgType(int msgType) {
		mMsgType = msgType;
	}

	public long getThreadId() {
		return mThreadId;
	}

	public void setThreadId(long threadId) {
		mThreadId = threadId;
	}

	public int getReadStatus() {
		return mReadStatus;
	}

	public void setReadStatus(int readStatus) {
		mReadStatus = readStatus;
	}

	public String getAddress() {
		return mAddress;
	}

	public void setAddress(String address) {
		mAddress = address;
	}

	public long getDate() {
		return mDate;
	}

	public void setDate(long date) {
		mDate = date;
	}

	public String getMmsSubject() {
		return mMmsSubject;
	}

	public void setMmsSubject(String subject) {
		mMmsSubject = subject;
	}

	public String getSmsContent() {
		return mSmsContent;
	}

	public void setSmsContent(String content) {
		mSmsContent = content;
	}

	public void setMmsContent(String content) {
		mMmsContent = content;
	}

	public String getMmsContent() {
		return mMmsContent;
	}

	@Override
	public int compareTo(MessageInfo another) {
		if (another == null) {
			return -1;
		}

		long value = another.getDate() - this.getDate();
		if (value > 0) {
			return 1;
		} else if (value < 0) {
			return -1;
		} else {
			return 0;
		}
	}

	@Override
	public String toString() {
		return String.format(
				"%s(0x%08x):[state:%d, date:%d, contact:%s, content:%s]", this
						.getClass().getSimpleName(), hashCode(), mReadStatus,
				mDate, mAddress, mMmsSubject);
	}

}
